namespace BM.Tools.WebControls.MForm.Navigation
{
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;

    /// <summary>
    /// The navigator interface that can be implemented to search the node tree of certain type
    /// </summary>
    /// <typeparam name="T">
    /// The type of the navigable object.
    /// </typeparam>
    public interface INavigator<T>
    {        
        /// <summary>
        /// Gets Parent.
        /// </summary>
        /// <value>
        /// The parent.
        /// </value>
        INavigator<T> Parent
        {
            get;
        }

        /// <summary>
        /// performs the selection
        /// </summary>
        /// <returns>
        /// the enumerable of objects of type
        /// </returns>
        [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Select", Justification = "The name is used on purpose to resemble XPathNavigator Select method name.")]
        IEnumerable<T> Select();

        /// <summary>
        /// Provides the <see cref="NavigatorQuery{T}" /> object that can move through the tree.
        /// </summary>
        /// <param name="item">
        /// The item on which the query run.
        /// </param>
        /// <returns>
        /// the NavigatorQuery object
        /// </returns>
        NavigatorQuery<T> Query(T item);
    }
}